﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameName1
{
    abstract class Projectile : GameObject, IProjectileObservable
    {
        public static Texture2D sprite;
        private List<IProjectileObserver> observers = new List<IProjectileObserver>(); 

        public Projectile(Vector2 position, Vector2 velocity)
        {
            this.Position = position;
            this.Velocity = velocity;
        }

        public void Notify(Projectile projectile)
        {
            foreach (var observer in observers)
            {
                observer.Update(this);
            }
        }

        public void RegisterObserver(IProjectileObserver observer)
        {
            observers.Add(observer);
        }

        public void RemoveObserver(IProjectileObserver observer)
        {
            observers.Remove(observer);
        }
    }
}
